package com.doubledr.light_lock.utils;

import android.content.Context;

import java.io.File;

public class ResManager {

    public static int getDrawableRes(Context context, String name) {
        String packageName = context.getPackageName();
        return context.getResources().getIdentifier(name, "drawable", packageName);
    }
    public static int getIcon(File f,Context context){
        if(f.isDirectory()){
            return getDrawableRes(context,"folder");
        }
        String extName = FileManager.getExtensionName(f.getName());

        if(extName.equalsIgnoreCase("jpg") || extName.equalsIgnoreCase("png")){
            return getDrawableRes(context,"pic");
        }
        else if(extName.toLowerCase().equalsIgnoreCase("ept")){
            return getDrawableRes(context,"lock");
        }
        else {
            return getDrawableRes(context,"video");
        }
    }
}
